package service.impl;

import bean.dto.EquipmentPage;
import bean.pojo.Maintenance;
import dao.EquipmentMaintenanceDao;
import dao.impl.EquipmentMaintenanceDaoImpl;
import service.EquipmentMaintenanceService;

import java.util.List;

/**
 * service.impl
 * User: xlh
 * Date: 2024/12/20 10:10
 * motto:推到高塔
 * Description:
 * Version: V1.0
 */
public class EquipmentMaintenanceServiceImpl implements EquipmentMaintenanceService {
    EquipmentMaintenanceDao equipmentMaintenanceDao=new EquipmentMaintenanceDaoImpl();
    @Override
    public List<Maintenance> findByPage(EquipmentPage equipmentPage) {
        return equipmentMaintenanceDao.findByPage(equipmentPage);
    }

    @Override
    public Long findByTotal(EquipmentPage equipmentPage) {
        //验证有没有值
        if(equipmentPage.getSelectMonth()==null  ||  equipmentPage.getSelectMonth().trim().length()==0){
            equipmentPage.setSelectMonth(null);
        }
        if(equipmentPage.getSelectedStatus()==null  ||  equipmentPage.getSelectedStatus().trim().length()==0){
            equipmentPage.setSelectedStatus(null);
        }
        return   equipmentMaintenanceDao.findByTotal(equipmentPage);
    }

    @Override
    public boolean updatMaintenance(Maintenance maintenance) {
        {
            return equipmentMaintenanceDao.updatMaintenance(maintenance);
        }
    }

    @Override
    public boolean createMaintenance(Maintenance maintenance) {
        return equipmentMaintenanceDao.createMaintenance(maintenance);
    }
}
